import 'package:gold/generated/json/base/json_field.dart';
import 'package:gold/generated/json/user_model.g.dart';
import 'dart:convert';
export 'package:gold/generated/json/user_model.g.dart';

@JsonSerializable()
class UserModel {
	int? uid;
	/// 昵称
	String? nickname;
	/// 头像
	String? avatar;
	/// 性别 （N：未知、M：男、F：女）
	String? sex;
	/// 出生日期
	int? birthday;
	/// 用户角色，0：普通用户、1：推广员、2：店主
	int? role;
	/// 可用积分
	int? points;
	/// 可用余额（元）
	double? amount;
	/// 冻结余额（元）
	@JSONField(name: "locked_amount")
	String? lockedAmount;
	/// 邀请码
	@JSONField(name: "inv_code")
	String? invCode;
	/// 注册时间
	@JSONField(name: "created_at")
	String? createdAt;
	/// 账户信息修改时间
	@JSONField(name: "updated_at")
	String? updatedAt;
	/// 删除时间
	@JSONField(name: "deleted_at")
	String? deletedAt;
	/// 用户信息
	UserInfo? user;

	UserModel();

	factory UserModel.fromJson(Map<String, dynamic> json) => $UserModelFromJson(json);

	Map<String, dynamic> toJson() => $UserModelToJson(this);

	@override
	String toString() {
		return jsonEncode(this);
	}
}

@JsonSerializable()
class UserInfo {
	int? uid;
	/// 手机号
	int? mobile;

	UserInfo();

	factory UserInfo.fromJson(Map<String, dynamic> json) => $UserInfoFromJson(json);

	Map<String, dynamic> toJson() => $UserInfoToJson(this);

	@override
	String toString() {
		return jsonEncode(this);
	}
}